local skynet = require "skynet"
local filelog = require "filelog"
local msghelper = require "gmsvrhelper"
local base = require "base"
local serverbase = require "serverbase"
local table = table
require "skynet.manager"

local params = ...

local Gmsvrd = serverbase:new({
	agent_pool = nil,	
	http_sessions = {},
	server_socket_fd = 0,
	conf = nil,
})

function Gmsvrd:tostring()
	return "Gmsvrd"
end

local function Gmsvrd_to_sring()
	return Gmsvrd:tostring()
end

function  Gmsvrd:init()
	msghelper:init(Gmsvrd)
	self.eventmng.init(Gmsvrd)
	self.eventmng.add_eventbyname("cmd", "gmsvrcmd")
	Gmsvrd.__tostring = Gmsvrd_to_sring
end

skynet.start(function()
	if params == nil then
		Gmsvrd:start()
	else		
		Gmsvrd:start(table.unpack(base.strsplit(params, ",")))
	end	
end)